<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
    <script src="{$Think.config.httpFlag}{$Think.config.google_map_url}" async="async"></script>
</head>

<body>
    <div class="layui-fluid main">
        <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
            <form class="layui-form serch" action="/admin/poi/citypoi.shtml" method="post">
                <div class="layui-form-item" style="float: left;">
                    <div class="layui-input-inline">
                        <input type="text" name="cityname" lay-verify="title" autocomplete="off" placeholder="请输入城市名称" class="layui-input layui-btn-sm">
                    </div>
                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                </div>
            </form>
        </fieldset>
        <div style="display: inline-block;width: 20%">
            <table class="layui-table"  lay-even="" lay-skin="line" >
                <colgroup>
                    <col width="100">
                    <col width="400">
                    <col width="300">
                    <col width="200">
                </colgroup>
                <thead>
                <tr>
                    <th>ID</th>
                    <th>城市</th>
                    <th>POI数量</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>

                <tr>
                    <td>asd</td>
                    <td><strong>北京</strong><br/>beijing</td>
                    <td>123</td>
                    <td class="operation-menu">
                        <a href="{:url('admin/poi/poisee')}" class="layui-btn layui-btn-xs" style="margin-left: 0;font-size:12px;">查看POI</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>


        <div class="right75" style="margin: 10px 0">
            <div style="margin: 10px  0">
                弹幕的，那是，对面那是，没到那时，没到那时，买电脑，马十多年，马十多年，马十多年，吗
            </div>
            <div id="map" style="height: 500px;width: 100%">

            </div>
        </div>
</div>
<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>

<script type="text/javascript">

    $('.delete').click(function(){
        var id = $(this).attr('id');
        layer.confirm('确定要删除?', function(index) {
            $.ajax({
                url:"{:url('admin/admin/adminCateDelete')}",
                data:{id:id},
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            location.href = res.url;
                        },1500)
                    }
                }
            })
        })
    })
</script>
<script type="text/javascript">
    layui.use('layer', function(){
        var layer = layui.layer;
        $('.a_menu').click(function(){
            var url = $(this).attr('href');
            var a = 0;
            $.ajax({
                url:url
                ,async:false
                ,success:function(res){
                    if(res.code == 0) {
                        layer.msg(res.msg);
                        a = 1;
                    }
                }
            })
            if(a === 0) {
                layer.open({
                    type:2,
                    content:url,
                    area: ['500px', '400px'],
                    end:function(){
                        location.reload();
                    }
                });
            }
            return false;
        })

        $('.preview').click(function(){
            var url = $(this).attr('href');
            layer.open({
                type:2,
                content:url,
                area: ['550px', '400px']
            });
            return false;
        })
    });
</script>
        <script type="text/javascript">
            var geocoder;
            var map2;
            //实际查询地址
            //var query = "辽宁沈阳文化路三号巷11号";
            //var query = "东北大学北门";
            //显示名称
            //var display = "<b>单位: </b>东北大学";
            function initialize() {
                geocoder = new google.maps.Geocoder();
                var myOptions = {
                    zoom : 10,//缩放比例
                    //地图类型 •MapTypeId.ROADMAP •MapTypeId.SATELLITE
                    //•MapTypeId.HYBRID •MapTypeId.TERRAIN
                    center:new google.maps.LatLng(39.90419989999999, 116.40739630000007),
                    mapTypeId : google.maps.MapTypeId.ROADMAP
                }
                map2 = new google.maps.Map(document.getElementById("map"),
                        myOptions);
                codeAddress();
            }
            var marker=new google.maps.Marker();
            function codeAddress() {
                var address = document.getElementById("address").value;
                //地址解析
                geocoder.geocode({
                    'address' : address
                }, function(results, status) {
                    console.log(results);
                    if (status == google.maps.GeocoderStatus.OK) {
                        //依据解析的经度纬度设置坐标居中

                        map2.setCenter(results[0].geometry.location);
//                alert(results[0].geometry.location);//坐标
                        // alert(results[0].formatted_address);//地址
                        marker = new google.maps.Marker({
                            map : map2,
                            position : results[0].geometry.location,
                            title : address,
                            //坐标动画效果
                            animation : google.maps.Animation.DROP
                        });
                        marker.setMap(map2);

//                var display = "地址: " + results[0].formatted_address;
//                var infowindow = new google.maps.InfoWindow({
//                    content : "<span style='font-size:11px'><b>名称: </b>"
//                    + address + "<br>" + display + "</span>",
//                    //坐标偏移量，一般不用修改
//                    pixelOffset : 0,
//                    position : results[0].geometry.location
//
//                });
//                //默认打开信息窗口,点击做伴弹出信息窗口
//
//                infowindow.open(map2, marker);
//                google.maps.event.addListener(marker, 'click', function() {
//
//                    infowindow.open(map2, marker);
//                });
                    } else {
                        //alert("Geocode was not successful for the following reason: " + status);
                    }
                });
            }
            initialize();
            $("#address").on("input",function(){
                marker.setMap(null);
                codeAddress();
            })
        </script>
</body>
</html>
